package ApnWrapper;
use strict;
use warnings;
use XML::Simple;
use Data::Dumper;

sub new {
	my $class = shift;
	my $ref = {
		_path => shift,
		_version => undef,
		_platform => undef,
		_project => undef,
		_isOppo => undef,
		_list => undef,
		_num => 0,
	};

	bless $ref, $class;
	loadApn($ref);
	return $ref;
}

sub loadApn {

	my $ref = shift;
	if (-e $ref->{_path}) {
		my $xmlList = XMLin($ref->{_path});
		$ref->{_list} = $xmlList->{"apn"};
		$ref->{_num} =  @{$ref->{_list}};
		Log("apn is loaded from : " . $ref->{_path});
	} else {
		Log("failed to load apn : " . $ref->{_path});
	}
	#print Dumper($ref->{_list});
}
sub getApnNum {
	my $ref = shift;
	return $ref->{_num};
}
sub Log {
	#print "ApnWrapper : " . shift . "\n";
}

1;
